Fix some minor file descriptor leaks and related glitches.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 19 Jul 2013 18:09:23 +0000 (11:09 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 19 Jul 2013 18:09:23 +0000 (11:09 -0700)
commit3961bd5799169d6e24e151a8fc06d637c348eb93
tree1fad497cef9fdaf99cba733856ab02514bd630db
parent6c24897ee82e3548b95d4e62b8095c3d59c9e465
Fix some minor file descriptor leaks and related glitches.

* filelock.c (create_lock_file) [!O_CLOEXEC]: Use fcntl with FD_CLOEXEC.
(create_lock_file): Use write, not emacs_write.
* image.c (slurp_file, png_load_body):
* process.c (Fnetwork_interface_list, Fnetwork_interface_info)
(server_accept_connection):
Don't leak an fd on memory allocation failure.
* image.c (slurp_file): Add a cheap heuristic for growing files.
* xfaces.c (Fx_load_color_file): Block input around the fopen too,
as that's what the other routines do.  Maybe input need not be
blocked at all, but it's better to be consistent.
Avoid undefined behavior when strlen is zero.
src/ChangeLog
src/filelock.c
src/image.c
src/process.c
src/xfaces.c